<nz-card>
  <div nz-row class="mb-md">
    <div nz-col nzSpan="6">
      设备编号
      <input nz-col nzSpan="16" nz-input [(ngModel)]="this.searchBeans[0].attributeValue" name="username" />
    </div>

    <div nz-col nzSpan="6">
      设备名称
      <input nz-col nzSpan="16" nz-input [(ngModel)]="this.searchBeans[1].attributeValue" name="username" />
    </div>

    <div nz-col nzSpan="2">
      <nz-switch [(ngModel)]="this.searchBeans[2].attributeValue" (ngModelChange)="loadListData()"  nzCheckedChildren="报废"
                 nzUnCheckedChildren="在用"></nz-switch>
    </div>

    <div nz-col nzSpan="3">
      <button nz-button (click)="this.loadListData()" [nzType]="'primary'">搜索</button>
      <button nz-button (click)="this.clearParam(); this.loadListData()">重置</button>
    </div>

  </div>

  <nz-divider [nzDashed]=true style="margin: 0;padding: 0"></nz-divider>

  <div style="padding: 10px;">
    <button nz-button (click)="open()" [nzType]="'primary'">新增</button>
    <button nz-button nz-popconfirm
            nzPopconfirmTitle="确认删除选中吗?"
            nzPopconfirmPlacement="right"
            (nzOnConfirm)="delete()"
            (nzOnCancel)="cancel()">删除
    </button>
  </div>

  <nz-table #basicTable [nzData]="deviceGroups" [nzLoading]="loading" nzBordered nzSize="small">
    <thead>
    <tr>
      <th>设备编号</th>
      <th>设备名称</th>
      <th>设备类型</th>
      <th>分类</th>
      <th>品牌</th>
      <th>出厂编号</th>
      <th>供应商</th>
      <th>购买日期</th>
      <th>购买金额</th>
      <th>状态</th>
      <th>责任人</th>
      <th>操作区</th>
    </tr>
    </thead>
    <tbody>
    <tr *ngFor="let data of basicTable.data">
      <td>{{data.code}}</td>
      <td>{{data.name}}</td>
      <td>{{data.deviceGroup?.name}}</td>
      <td>{{data.type}}</td>
      <td>{{data.brand}}</td>
      <td>{{data.serialNum}}</td>
      <td>{{data.supplier}}</td>
      <td>{{data.buyDate}}</td>
      <td>{{data.buyMoney}}</td>
      <td>
        <nz-tag nzColor="{{data.scrapped ? 'error': 'success' }}">{{data.scrapped ? '报废' : '在用'}}</nz-tag>
      </td>
      <td>{{data.responsible?.username}}</td>
      <td>
        <a *ngIf="data.scrapped != true" nz-button nzType="link" style="padding: 3px" (click)="openEdit(data)">编辑</a>
<!--        <a nz-button nzType="link" style="padding: 3px" (click)="delete(data.id)">删除</a>-->
        <a *ngIf="data.scrapped != true" nz-button nzType="link" style="padding: 3px" (click)="scrap(data)">报废</a>
      </td>
    </tr>
    </tbody>
  </nz-table>
</nz-card>

<app-device-edit #deviceEditComponent (voted)="onSmt()"></app-device-edit>

<app-device-scrap #deviceScrapComponent (voted)="onSmt()"></app-device-scrap>
